gizmo: Add a way to set accessible role
authorMatthias Clasen <mclasen@redhat.com>
Wed, 14 Oct 2020 22:37:14 +0000 (18:37 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 15 Oct 2020 01:04:25 +0000 (21:04 -0400)
This will be used for some of the gizmo used
inside GtkNotebook.

gtk/gtkgizmo.c
gtk/gtkgizmoprivate.h

index a929248a5c07116c3fa5a23fb7517266166c96cd..00162645b32e2150b1a03d530d372eb6f47c9e4a 100644 (file)
@@ -130,9 +130,30 @@ gtk_gizmo_new (const char            *css_name,
                GtkGizmoContainsFunc   contains_func,
                GtkGizmoFocusFunc      focus_func,
                GtkGizmoGrabFocusFunc  grab_focus_func)
+{
+  return gtk_gizmo_new_with_role (css_name,
+                                  GTK_ACCESSIBLE_ROLE_WIDGET,
+                                  measure_func,
+                                  allocate_func,
+                                  snapshot_func,
+                                  contains_func,
+                                  focus_func,
+                                  grab_focus_func);
+}
+
+GtkWidget *
+gtk_gizmo_new_with_role (const char            *css_name,
+                         GtkAccessibleRole      role,
+                         GtkGizmoMeasureFunc    measure_func,
+                         GtkGizmoAllocateFunc   allocate_func,
+                         GtkGizmoSnapshotFunc   snapshot_func,
+                         GtkGizmoContainsFunc   contains_func,
+                         GtkGizmoFocusFunc      focus_func,
+                         GtkGizmoGrabFocusFunc  grab_focus_func)
 {
   GtkGizmo *gizmo = GTK_GIZMO (g_object_new (GTK_TYPE_GIZMO,
                                              "css-name", css_name,
+                                             "accessible-role", role,
                                              NULL));
 
   gizmo->measure_func  = measure_func;
index 478af19971ef236d4f586046163bb5b7e3b01125..9257201a59def6f2b238ba50bea3e4b9f3c1e117 100644 (file)
@@ -3,6 +3,7 @@
 #define __GTK_GIZMO_H__
 
 #include "gtkwidget.h"
+#include "gtkenums.h"
 
 #define GTK_TYPE_GIZMO                 (gtk_gizmo_get_type ())
 #define GTK_GIZMO(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_GIZMO, GtkGizmo))
@@ -61,5 +62,14 @@ GtkWidget *gtk_gizmo_new (const char            *css_name,
                           GtkGizmoFocusFunc      focus_func,
                           GtkGizmoGrabFocusFunc  grab_focus_func);
 
+GtkWidget *gtk_gizmo_new_with_role (const char            *css_name,
+                                    GtkAccessibleRole      role,
+                                    GtkGizmoMeasureFunc    measure_func,
+                                    GtkGizmoAllocateFunc   allocate_func,
+                                    GtkGizmoSnapshotFunc   snapshot_func,
+                                    GtkGizmoContainsFunc   contains_func,
+                                    GtkGizmoFocusFunc      focus_func,
+                                    GtkGizmoGrabFocusFunc  grab_focus_func);
+
 
 #endif